package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppDeviceBaseInfo;
import com.ep.modules.app.service.AppDeviceBaseInfoService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/device_base_info")
public class AppDeviceBaseInfoController {
    @Autowired
    private AppDeviceBaseInfoService appDeviceBaseInfoService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appDeviceBaseInfoService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppDeviceBaseInfo appdevicebaseinfo = appDeviceBaseInfoService.getById(id);
        return R.ok().put("appdevicebaseinfo", appdevicebaseinfo);
    }

    @SysLog("保存AppDeviceBaseInfo")
    @PostMapping("/save")
    public R save(@RequestBody AppDeviceBaseInfo appdevicebaseinfo) {
        ValidatorUtils.validateEntity(appdevicebaseinfo);
        appDeviceBaseInfoService.save(appdevicebaseinfo);
        return R.ok();
    }

    @SysLog("修改AppDeviceBaseInfo")
    @PostMapping("/update")
    public R update(@RequestBody AppDeviceBaseInfo appdevicebaseinfo) {
        ValidatorUtils.validateEntity(appdevicebaseinfo);
        appDeviceBaseInfoService.update(appdevicebaseinfo);
        return R.ok();
    }

    @SysLog("删除AppDeviceBaseInfo")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appDeviceBaseInfoService.deleteBatch(ids);
        return R.ok();
    }
}